#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    : 2023/11/15 23:20
# @function: the script is used to do something.
# @version : 

import requests


# 定义url
url = 'https://www.baidu.com'

# 发送请求
response = requests.get(url)

# 定义正确的编码集
response.encoding = 'utf-8'
# 打印文本数据，查看响应的内容
# print(response.text)

# 1.获取原始数据【字节获取】
# print(response.content.decode('utf-8'))  # decode将字节对象转为字符串对象，并设置编码集为utf-8

# 2.获取json信息
# print(response.json())

# 3.获取请求头信息
# print(response.request.headers)

# 4.获取响应对象的状态码
# print(response.status_code)

# 5.获取响应头
# print(response.headers)

# 6.获取cookies
# print(response.cookies)
